define(['registry', 'collections/record_list', 'views/list_item', 'views/form'],
function(app_registry, Records, RecordView, Form) {
  var ListView = Backbone.View.extend({
   
    el: '#list-view',
    // tagName: 'table',
    template: _.template($('#list-view-template').html()),

    events: {
      'item_selected': 'showDetail'
    },

    initialize: function(d) {
      this.listenTo(this.collection, 'add', this.addOne);
      this.listenTo(this.collection, 'reset', this.addAll);
    },

    render: function() {
      // this.$el.append(this.template()));
      return this;
    },

    addOne: function(item) {
      var view = new RecordView({ model: item });
      this.$el.append(view.render().el);
    },

    addAll: function() {
      this.$el.html('');
      this.collection.each(this.addOne, this);
    },

    showDetail: function(e, data) {
    }
  });

  return ListView;
});